<?php
// +----------------------------------------------------------------------
// |     【{{$table_hump}}】Model模型类
// +----------------------------------------------------------------------

declare (strict_types = 1);

namespace app\common\model;

use think\Model;
use think\model\concern\SoftDelete;

class {{$table_hump}} extends Model{
    use SoftDelete;
    {{$model_del}}
    // 获取列表
    public static function getList($where = []){
        $limit = I('get.limit/d');
        {{$model_search}}
        $list = self::order('id','desc')->where($where)->paginate($limit);
        return ['code'=>0,'data'=>$list->items(),'extend'=>['count' => $list->total(), 'limit' => $limit]];
    }
	
	// 获取列表数据
	public static function listData($where=[],$order="",$n_page=0,$limit=20){
		$data=self::order($order)->where($where);
		if($n_page>0){
			$data=$data->page($n_page,$limit);
		}
		$data=$data->select()->toArray();
		
		return $data;
	}
	
	// 获取某个单条记录
	public static function info($id){
		if(!is_array($id)){
			$model=self::find($id);
		}else{
			$model=self::where($id)->find();
		}
		return $model;		
	}
	
	/** 获取器 **/
	
}
